import request from '@/axios'
const scope = 'server'
export const loginByUserName = (username, password) => {
  let grant_type = 'password'
  return request({
    url: '/auth/auth/oauth/token',
    method: 'post',
    headers: {
      isToken:false,
      'Authorization': 'Basic YWRtaW46YWRtaW4='
    },
    params: { username, password,grant_type,scope }
  })
}

export const getUserInfo = () => request({
  url:  '/upms/upms/user/getUserInfo',
  method: 'get'
});

export const refreshToken = () => request({
  url:  '/user/refresh',
  method: 'post'
})

export const logout = () => request({
  url:  '/user/logout',
  meta: {
    isToken: false
  },
  method: 'get'
})